package ketang.unit5;

import java.util.LinkedList;

public class QueueTest {
    private LinkedList list=new LinkedList();
    //入队
    public void put(Object o){
        list.addLast(o);
    }
    //出队
    public Object get(){
        return list.removeFirst();
    }
    //队列是否为空
    public boolean empty(){
        return  list.isEmpty();
    }

    public static void main(String[] args) {
        QueueTest q=new QueueTest();
        //入队
        q.put("1");
        q.put("2");
        q.put("3");
        //出队
        System.out.println("出队元素:"+q.get());
        System.out.println("出队元素:"+q.get());
        System.out.println("出队元素:"+q.get());
        System.out.println("队列是否为空:"+q.empty());
    }
}
